# Maintainer: Anjandev Momi <anjan@momi.ca>
pkgname=codemadness-frontends
pkgver=0.5
pkgrel=3
pkgdesc="Experimental (cli, web, and gopher) frontends for youtube, reddit, & duckduckgo"
url="https://www.codemadness.org/idiotbox.html"
arch="all !ppc64le"
license="ISC"
makedepends="libretls-dev"
options="!check" # Has no tests
source="$pkgname-$pkgver.tar.gz::https://codemadness.org/releases/frontends/frontends-$pkgver.tar.gz"
builddir="$srcdir/frontends-$pkgver"

prepare() {
	sed -i 's/^#FRONTENDS_/FRONTENDS_/g' Makefile
	sed -i 's/^#LIBTLS_/LIBTLS_/g' Makefile
	default_prepare
}

build() {
	make \
		LIBTLS_LDFLAGS="$(pkg-config --libs libtls)" \
		LIBTLS_LDFLAGS_STATIC="$(pkg-config --libs --static libtls)" \
		CFLAGS="$CFLAGS $(pkg-config --cflags libtls)"
}

package() {
	install -Dm755 youtube/cgi $pkgdir/usr/bin/youtube-cgi
	install -Dm755 youtube/gopher $pkgdir/usr/bin/youtube-gopher
	install -Dm755 youtube/cli $pkgdir/usr/bin/youtube-cli

	install -Dm755 duckduckgo/gopher $pkgdir/usr/bin/duckduckgo-gopher
	install -Dm755 duckduckgo/cli $pkgdir/usr/bin/duckduckgo-cli

	install -Dm755 reddit/gopher $pkgdir/usr/bin/reddit-gopher
	install -Dm755 reddit/cli $pkgdir/usr/bin/reddit-cli
}


sha512sums="
df5ef18112921f355eabb577c2824e1fc99806eed5a47f6636baf176d6574c4be3d23fb2c0c34ebc896360b0a3754650eaf1c66702b88122efb49c4b30ff913a  codemadness-frontends-0.5.tar.gz
"
